package com.xsr.exception;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.servlet.ModelAndView;

/**
 * @author 邢式瑞
 * @version 1.0
 * @project sssm
 * @date 2022/9/17 10:57
 */
@ControllerAdvice
public class MyException {
    @ExceptionHandler(Exception.class)
    public ModelAndView exception(Exception e){
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.addObject("error",e);
        modelAndView.setViewName("error");
        return modelAndView;
    }
}
